Skip to content

allow -1 sound index in OPF_GAME_SND syntax check#7540

Merged
BMagnu merged 1 commit into
scp-fs2open:masterfrom
Goober5000:fix/gamesnd_syntax
Jun 20, 2026
Merged

allow -1 sound index in OPF_GAME_SND syntax check#7540
BMagnu merged 1 commit into
scp-fs2open:masterfrom
Goober5000:fix/gamesnd_syntax

Conversation

@Goober5000

Copy link
Copy Markdown
Contributor

The numeric branch of the OPF_GAME_SND check in check_sexp_syntax never actually ran until the type2 variable-overload bug was fixed, so missions using a sound index of -1 ("no sound" / "default") loaded fine. Now that the check is live, explicitly allow -1, which the runtime already treats as an invalid (unset) sound. Also return the more descriptive SEXP_CHECK_INVALID_GAME_SND / SEXP_CHECK_INVALID_FIREBALL error codes, and let nested-operator (SEXP_ATOM_LIST) arguments fall through since their type is already validated upstream.

Also route the Lua SEXP soundentry argument through sexp_get_sound_index so it accepts a table index, an operator, or a name like the core SEXPs do, instead of only a name.

Follow-up to #7365.

The numeric branch of the OPF_GAME_SND check in check_sexp_syntax never
actually ran until the type2 variable-overload bug was fixed, so missions
using a sound index of -1 ("no sound" / "default") loaded fine.  Now that
the check is live, explicitly allow -1, which the runtime already treats as
an invalid (unset) sound.  Also return the more descriptive
SEXP_CHECK_INVALID_GAME_SND / SEXP_CHECK_INVALID_FIREBALL error codes, and
let nested-operator (SEXP_ATOM_LIST) arguments fall through since their type
is already validated upstream.

Also route the Lua SEXP soundentry argument through sexp_get_sound_index so
it accepts a table index, an operator, or a name like the core SEXPs do,
instead of only a name.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Goober5000 Goober5000 added fix A fix for bugs, not-a-bugs, and/or regressions. sexps A feature or issue related to SEXPs labels Jun 20, 2026
@BMagnu BMagnu added this to the Release 26.0 milestone Jun 20, 2026

@BMagnu BMagnu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes the failed mission loads in my test!

@BMagnu BMagnu merged commit fd2ebaf into scp-fs2open:master Jun 20, 2026
20 checks passed
@Goober5000 Goober5000 deleted the fix/gamesnd_syntax branch June 21, 2026 00:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix A fix for bugs, not-a-bugs, and/or regressions. sexps A feature or issue related to SEXPs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants